import * as types from './mutation_types'
import request from '../../../util/axios'

// 获取电子文件表头
export const getTableajHead = ({ commit }, tableId) => {
  commit(types.TABLEHEAD_SET_RETRIEVEDHEAD, null)
  return request({
    url: `/yuyi-category-boot/api/metadata/user/tableHead/${tableId}`,
    method: 'get',
    data: {}
  }).then((res) => {
    commit(types.TABLEHEAD_SET_RETRIEVEDHEAD, res.data.data)
    return res
  }).catch(e => {
    commit(types.TABLEHEAD_SET_RETRIEVEDHEAD, null)
    return e
  })
}

// 获取电子文件列表
export const getTableajList = ({ commit }, val) => {
  commit(types.TABLEHEAD_SET_RETRIEVEDLIST, null)
  return request({
    url: `/yuyi-category-boot/api/arc/data/${val.idTable}/list`,
    method: 'post',
    data: val.data
  }).then((res) => {
    commit(types.TABLEHEAD_SET_RETRIEVEDLIST, res.data.data)
  }).catch(e => {
    commit(types.TABLEHEAD_SET_RETRIEVEDLIST, null)
  })
}
